<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0;" name="viewport" />
        <title>后台面板</title>
        <link rel="stylesheet" href="http://cdn.amazeui.org/amazeui/2.4.2/css/amazeui.min.css">
        <style>
            body{background-color:#eee;}
            form{padding:5px;}
            hr{border:5px solid white;}
        </style>
    </head>
    <body>
        
        <header data-am-widget="header" class="am-header am-header-default">
            <h1 class="am-header-title">
                <a href="#title-link" class="">
                    后台面板
                </a>
            </h1>
        </header>
        
        <div id="content">
            <form class="am-form" method="post" action="doEdit">
                <input type="hidden" id="id" name="id" value="">
                <div class="am-form-group">
                    <label for="title">描述</label>
                    <input type="text" class="" name="title" id="title" placeholder="请输入签到表标题" required>
                </div>
                <button id="button" type="submit" class="am-btn am-btn-secondary"></button>
            </form>
        </div>
       
        <script src="http://apps.bdimg.com/libs/jquery/1.9.1/jquery.min.js"></script>
        <script src="http://cdn.amazeui.org/amazeui/2.4.2/js/amazeui.min.js"></script>
        <script>
            function getQueryString(name) { 
                var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i"); 
                var r = window.location.search.substr(1).match(reg); 
                if (r != null) return unescape(r[2]); return null; 
            } 
            $(document).ready(function(){
                var id = getQueryString("id");
                $("#id").val(id);
                $.AMUI.progress.inc();
                $.post("", {"id": id}, function(obj){
                    if(obj['_id'] == null){
                        $("#button").html("添加签到表");
                    }else{
                        $("#button").html("修改签到表");
                        $("#title").val(obj['title']);
                    }
                    $.AMUI.progress.done(true);
                });
            });
        </script>
    </body>
</html>
